import { Goods } from "@/api/service/goods/types";

const t = translate("公共模块");
export const showGoods = ref(false);

const formObject: Goods = {
  goodsId: "",
  goodsName: "",
  barCode: null,
  salesUnit: "",
  retailPrice: undefined,
  memberPrice: undefined,
  salePrice: undefined,
  qrcodeUrl: "",
  refreshTimes: "",
  goodsPhoto: "",
  deptId: "",
  createTime: "",
  expands: {} as any,
  department: "",
  category: "",
  tagCount: [],
  /*  */
  shelfLife: "",
  specif: "",
  sku: "",
  stock: undefined,
  itemNo: "",
  promotionBegin: "",
  promotionEnd: "",
  productionDate: "",
  warehouse: "",
  freightSpace: "",
  share: "0",
  grade: "",
  mode: "",
  origin: "",
  model: "",
  disable: false,
  goodsVideo: ""
};

export const form = ref<Goods>({
  ...formObject
});

export const resetForm = () => {
  form.value = {
    ...formObject
  };
};

export const keywordOptions = [
  {
    label: t.value?.["商品名称"],
    value: "goodsName"
  },
  {
    label: t.value?.["条形码"],
    value: "barCode"
  }
];

export const orderOptions = [
  {
    label: t.value?.["会员价"],
    value: "member_price"
  },
  {
    label: t.value?.["促销价"],
    value: "sale_price"
  },
  {
    label: t.value?.["创建时间"],
    value: "goods_id"
  }
];

export const extendsFields = ref<any[]>([]);
export const fileList = ref<any[]>([]);
export const categoryData = ref([]);
